<%@ page import="com.luojiaoj.User" %>
<!DOCTYPE html>
	<head>
		<meta name="layout" content="OJMain">
		<g:set var="entityName" value="${message(code: 'ljoj.onlinejudge.user.label', default: 'User')}" />
		<title><g:message code="default.create.label" args="[entityName]" /></title>
        <r:require modules="register" />
	</head>
	<body class="register">
		<div class="nav" role="navigation">
			<ul>
				<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
				<li><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
			</ul>
		</div>
		<div id="create-user" class="content scaffold-create" role="main">
			<h1><g:message code="default.create.label" args="[entityName]" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<g:hasErrors bean="${userInstance}">
			<ul class="errors" role="alert">
				<g:eachError bean="${userInstance}" var="error">
				<li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
				</g:eachError>
			</ul>
			</g:hasErrors>
			<g:form action="save" >
				<fieldset class="form">
                    <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'username', 'error')} required">
                        <label for="username">
                            <g:message code="ljoj.onlinejudge.user.username.label" default="Username" />
                            <span class="required-indicator">*</span>
                        </label>
                        <g:textField name="username" required="" value="${userInstance?.username}" minlength="6" />
                    </div>

                    <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'password', 'error')} required">
                        <label for="password">
                            <g:message code="ljoj.onlinejudge.user.password.label" default="Password" />
                            <span class="required-indicator">*</span>
                        </label>
                        <g:textField name="password" id="password" required="" value="${userInstance?.password}" minlength="6" />
                    </div>

                    <div class="fieldcontain required" ${hasErrors(bean: userInstance, field: 'repassword', 'error')} required>
                        <label for="repassword">
                            <g:message code="ljoj.onlinejudge.user.repassword.label" default="Password" />
                            <span class="required-indicator">*</span>
                        </label>
                        <g:textField name="repassword" required="" value="${userInstance?.password}"
                                     data-validation-matches-match="password" />
                    </div>

                    <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'email', 'error')} required">
                        <label for="email">
                            <g:message code="ljoj.onlinejudge.user.email.label" default="Email" />
                            <span class="required-indicator">*</span>
                        </label>
                        <g:field type="email" name="email" value="${userInstance?.email}" required=""/>
                        <p class="help-block"></p>
                    </div>

				</fieldset>
				<fieldset class="buttons">
					<g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" />
				</fieldset>
			</g:form>
		</div>
    <script type="text/javascript">
            $(function () {
                $("input,select,textarea").not("[type=submit]").jqBootstrapValidation();
            });
    </script>

	</body>
</html>
